<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
  <meta name="author" content="zhupeng">
  
  <script language="javascript" src="../script/common.js" type="text/javascript"></script>
  <script language="javascript" type="text/javascript">	
	var asnLength = 16
	//添加号段
	parent.dialog.hideBar();
	function onSave(){
		if(!checkForm("makeCard"))return;
	   	var cardBillId = getPara("cardBillId")
		var lowerCardNumber = $("lowerCardNumber").value;
		var upperCardNumber = $("upperCardNumber").value
		var subType = getPara("subType")
		var methodName = "addCardScope"
		if(subType == CardBillSubType.ADJUST_ONPASSAGE){
			methodName = "addCardScopeInOnPassageAdjustBill"
	   	}
	   	DWR.call("cardStoreService."+methodName,cardBillId,lowerCardNumber,upperCardNumber,function(v){
			if(v){showInformation("添加成功!")}
	   		dialogBackValue(v)
	   	},{blockScreen:true}); 
	}
	//计算号段长度
	function counter(cardNumber,countLength){
		var counters=$(cardNumber).value;   
		$(countLength).innerHTML=counters.length;
	}
	function selStoreCard(){
	    var opts={};
	    opts.cardStatus = getPara("cardStatus");
	    opts.cardTypeName = getPara("cardTypeName");
	    opts.billType = getPara("billType");
	    opts.targetOrg = getPara("targetOrg");
	    opts.subType = getPara("subType");
	    opts.targetOrgName = getPara("targetOrgName");
	    opts.originStoreStatus = getPara("originStoreStatus");
	    opts.adjustedId = getPara("adjustedId");
	    opts.adjustOutPackId = getPara("adjustOutPackId")
	    opts.cardTypeId = getPara("cardTypeId")
	    var url = spellUrl("/store/sel_cardscope_list.html",opts)
	    var titleName = "请选择卡片"
	    if(opts.subType == CardBillSubType.ADJUST_ONPASSAGE){
			titleName = "选择出库单内卡片"
		}
		var  v = openDialogFrame(url,titleName,464,700)
		if(v){
			$("lowerCardNumber").value= Format.fixLength(new String(v[1]),Project && Project.asnLength?Project.asnLength : 16,"0");
			$("upperCardNumber").value= Format.fixLength(new String(v[2]),Project && Project.asnLength?Project.asnLength : 16,"0");
			$("lowerCount").innerHTML=$("lowerCardNumber").value.length;
			$("upperCount").innerHTML=$("upperCardNumber").value.length;
		}
	}

	function load(){
		asnLength = Project && Project.asnLength ? Project.asnLength : 16
		var form = $("makeCard");
		form.lowerCardNumber.maxLength = asnLength;
		form.upperCardNumber.maxLength = asnLength;
	}
  </script>	
 </head>
<body onload="load()">
	<div id="goEnter">
		<form id="makeCard" name="makeCard" >
			<div class="form">
				<div class="formTitle">
					<table width="100%" cellSpacing=0 cellPadding=0 border=0>
						<tr>
							<td>请输入卡号段</td>
							<td align="right"><button type='button' onclick='selStoreCard()'>选择卡片</button> <span id="operateBut" align="right"></span></td>
						<tr>
					</table>
				</div>
				<table cellSpacing=0 cellPadding=4 width="100%" border=0>
					<tr>
						<td><label>起始卡号段:</label> <input type="text"  name="lowerCardNumber"   maxlength="16" onblur="if(checkDubleObjs($('makeCard').lowerCardNumber,$('makeCard').upperCardNumber,'asn','asn',true,true))compareValue($('makeCard').lowerCardNumber,$('makeCard').upperCardNumber,'ge','起始卡号段','结束卡号段');" onKeyUp="counter('lowerCardNumber','lowerCount');" ></td>
						<td><label>结束卡号段:</label> <input type="text"  name="upperCardNumber"   maxlength="16" onblur="if(checkDubleObjs($('makeCard').lowerCardNumber,$('makeCard').upperCardNumber,'asn','asn',true,true))compareValue($('makeCard').lowerCardNumber,$('makeCard').upperCardNumber,'ge','起始卡号段','结束卡号段');" onKeyUp="counter('upperCardNumber','upperCount');" ></td>
					</tr>
					<tr>
						<td><label>当前输入长度:</label> <span id="lowerCount">0</span></td>
						<td><label>当前输入长度:</label> <span id="upperCount">0</span></td>
					</tr>
				</table>
			</div>
		</form>
		<p align="center">
				<button type='button' id='saveBtn' name='saveBtn' onclick='onSave()'>确   认</button>&nbsp;&nbsp;&nbsp;<button type='button' onclick='window.close();' >取   消</button>
		</p>
	</div>
</body>
</html>
